PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

About Subroutines

A subroutine is a collection of statements that AppleScript runs in response to a user-defined command. Subroutines are similar to functions, methods, and procedures in other programming languages.

Subroutines are useful in scripts that perform the same action in more than one place. For example, if you have a series of statements for comparing values and you need to use those statements at several places in a script, you can package the statements as a subroutine and call it from anywhere in the script. Your script becomes shorter and easier to maintain. In addition, you can give subroutines descriptive names that make their purposes clear and make scripts easy to read.

The following sections describe how to write and call subroutines:


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)